package com.itheima.streamliu;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author zhangbaiyan
 * @date 2024-09-17 14:36
 * @description:
 * @version:
 */
public class test2 {
    public static void main(String[] args) {
        ArrayList<String> manList = new ArrayList<>();
        ArrayList<String> womanList = new ArrayList<>();

        Collections.addAll(manList,"张三,23","李四,24","王五,25");
        Collections.addAll(womanList,"赵六,26","孙七,27","孙八,28");

        Stream<String> stream1 = manList.stream().filter(s -> s.split(",")[0].startsWith("王")).limit(1);
        Stream<String> stream2 = womanList.stream().filter(s -> s.split(",")[0].startsWith("孙")).limit(2);
        System.out.println("-----------------------------------------------------------------------------------");
        List<Actor> collect = Stream.concat(stream1, stream2)
                .map(s -> new Actor(s.split(",")[0], Integer.parseInt(s.split(",")[1])))
                .collect(Collectors.toList());

        System.out.println(collect);
    }
}
